
type A = {
    name: string;
    age: number;
    address: number;
};
type B = {
    name: string;
    male: boolean;
    address: number;
};
type C = {
    name: string;
    age: number;
};
type D = {
    name: string;
    age: number;
    address: number;
};

type E = {
    name: string;
    address: string;
    age: number;
    male: boolean;
};
type F = {
    name: string;
    age: number;
    address: number;
};

// 对象的操作，结构的操作一般使用 Pick,Omit     集合中操作采用Extract, Exclude
// **交集 就是我们俩都有**
type UUU = Extract<keyof A, keyof B>; //两个都有
type ObjectInter<T extends object, U extends object> = Pick<T, Extract<keyof T, keyof U>>;
type R1 = ObjectInter<A, B>;
// **差集 就是我有你没有**
type TTT = Exclude<keyof A, keyof B>; //我有你没有
type ObjectDiff<T extends object, U extends object> = Pick<T, Exclude<keyof T, keyof U>>;
type R2 = ObjectDiff<B, A>;
// **补集, 补集就是差集，要求有父子关系**
type ObjectComp<T extends U, U extends object> = Pick<T, Exclude<keyof T, keyof U>>;
type R3 = ObjectComp<D, C>;
// **重写**
// 以后面的类型为准, 再加上以前比现在多的类型 mixin
// 为后面存在的类型，覆盖掉之气的类型，之前多的还是要保留的
type Overwrite<T extends object, U extends object> = ObjectInter<U, T> & ObjectDiff<T, U>;
type Computed<T> = {
  [K in keyof T]: T[K]
}
type R4 = Computed<Overwrite<E, F>>


export {}